import 'package:flutter/material.dart';
import 'package:music_app/widget/my_cached_network_image.dart';

// 歌曲更多点击弹窗
class SongActionBottomSheet extends StatelessWidget {
  final String title;
  final String artist;
  final String imageUrl;

  const SongActionBottomSheet({
    super.key,
    required this.title,
    required this.artist,
    required this.imageUrl,
  });

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Container(
        padding: const EdgeInsets.all(16),
        decoration: const BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
        ),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            Row(
              children: [
                ClipRRect(
                  borderRadius: BorderRadius.circular(8),
                  child: MyCachedNetworkImage(
                    imageUrl: imageUrl,
                    width: 50,
                    height: 50,
                    x: 200,
                    y: 200,
                  ),
                ),
                const SizedBox(width: 12),
                Expanded(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                        title,
                        style: const TextStyle(
                            fontSize: 16, fontWeight: FontWeight.bold),
                        overflow: TextOverflow.ellipsis,
                      ),
                      const SizedBox(height: 4),
                      Text(
                        artist,
                        style: TextStyle(
                          fontSize: 14,
                          color: Colors.grey.shade600,
                        ),
                        overflow: TextOverflow.ellipsis,
                      ),
                    ],
                  ),
                )
              ],
            ),
            const SizedBox(height: 20),
            _buildAction(Icons.favorite_border, "喜欢", () {
              Navigator.pop(context);
            }),
            _buildAction(Icons.playlist_add, "收藏到歌单", () {
              Navigator.pop(context);
            }),
            _buildAction(Icons.skip_next, "下一首播放", () {
              Navigator.pop(context);
            }),
          ],
        ),
      ),
    );
  }

  Widget _buildAction(IconData icon, String label, VoidCallback onTap) {
    return ListTile(
      leading: Icon(icon),
      title: Text(label),
      onTap: onTap,
    );
  }
}
